package com.zhouxiaoge.antlr4.rows;// Generated from .\Rows.g4 by ANTLR 4.10.1

import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;

import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class RowsParser extends Parser {
    static {
        RuntimeMetaData.checkVersion("4.10.1", RuntimeMetaData.VERSION);
    }

    protected static final DFA[] _decisionToDFA;
    protected static final PredictionContextCache _sharedContextCache =
            new PredictionContextCache();
    public static final int
            TAB = 1, NL = 2, STUFF = 3;
    public static final int
            RULE_file = 0, RULE_row = 1;

    private static String[] makeRuleNames() {
        return new String[]{
                "file", "row"
        };
    }

    public static final String[] ruleNames = makeRuleNames();

    private static String[] makeLiteralNames() {
        return new String[]{
                null, "'\\t'"
        };
    }

    private static final String[] _LITERAL_NAMES = makeLiteralNames();

    private static String[] makeSymbolicNames() {
        return new String[]{
                null, "TAB", "NL", "STUFF"
        };
    }

    private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
    public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);

    /**
     * @deprecated Use {@link #VOCABULARY} instead.
     */
    @Deprecated
    public static final String[] tokenNames;

    static {
        tokenNames = new String[_SYMBOLIC_NAMES.length];
        for (int i = 0; i < tokenNames.length; i++) {
            tokenNames[i] = VOCABULARY.getLiteralName(i);
            if (tokenNames[i] == null) {
                tokenNames[i] = VOCABULARY.getSymbolicName(i);
            }

            if (tokenNames[i] == null) {
                tokenNames[i] = "<INVALID>";
            }
        }
    }

    @Override
    @Deprecated
    public String[] getTokenNames() {
        return tokenNames;
    }

    @Override

    public Vocabulary getVocabulary() {
        return VOCABULARY;
    }

    @Override
    public String getGrammarFileName() {
        return "Rows.g4";
    }

    @Override
    public String[] getRuleNames() {
        return ruleNames;
    }

    @Override
    public String getSerializedATN() {
        return _serializedATN;
    }

    @Override
    public ATN getATN() {
        return _ATN;
    }


    int col;

    public RowsParser(TokenStream input, int col) {
        this(input);
        this.col = col;
    }

    public RowsParser(TokenStream input) {
        super(input);
        _interp = new ParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);
    }

    public static class FileContext extends ParserRuleContext {
        public List<RowContext> row() {
            return getRuleContexts(RowContext.class);
        }

        public RowContext row(int i) {
            return getRuleContext(RowContext.class, i);
        }

        public List<TerminalNode> NL() {
            return getTokens(RowsParser.NL);
        }

        public TerminalNode NL(int i) {
            return getToken(RowsParser.NL, i);
        }

        public FileContext(ParserRuleContext parent, int invokingState) {
            super(parent, invokingState);
        }

        @Override
        public int getRuleIndex() {
            return RULE_file;
        }

        @Override
        public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
            if (visitor instanceof RowsVisitor) return ((RowsVisitor<? extends T>) visitor).visitFile(this);
            else return visitor.visitChildren(this);
        }
    }

    public final FileContext file() throws RecognitionException {
        FileContext _localctx = new FileContext(_ctx, getState());
        enterRule(_localctx, 0, RULE_file);
        int _la;
        try {
            enterOuterAlt(_localctx, 1);
            {
                setState(7);
                _errHandler.sync(this);
                _la = _input.LA(1);
                do {
                    {
                        {
                            setState(4);
                            row();
                            setState(5);
                            match(NL);
                        }
                    }
                    setState(9);
                    _errHandler.sync(this);
                    _la = _input.LA(1);
                } while (_la == STUFF);
            }
        } catch (RecognitionException re) {
            _localctx.exception = re;
            _errHandler.reportError(this, re);
            _errHandler.recover(this, re);
        } finally {
            exitRule();
        }
        return _localctx;
    }

    public static class RowContext extends ParserRuleContext {
        public int i = 0;
        public Token STUFF;

        public List<TerminalNode> STUFF() {
            return getTokens(RowsParser.STUFF);
        }

        public TerminalNode STUFF(int i) {
            return getToken(RowsParser.STUFF, i);
        }

        public RowContext(ParserRuleContext parent, int invokingState) {
            super(parent, invokingState);
        }

        @Override
        public int getRuleIndex() {
            return RULE_row;
        }

        @Override
        public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
            if (visitor instanceof RowsVisitor) return ((RowsVisitor<? extends T>) visitor).visitRow(this);
            else return visitor.visitChildren(this);
        }
    }

    public final RowContext row() throws RecognitionException {
        RowContext _localctx = new RowContext(_ctx, getState());
        enterRule(_localctx, 2, RULE_row);
        int _la;
        try {
            enterOuterAlt(_localctx, 1);
            {
                setState(13);
                _errHandler.sync(this);
                _la = _input.LA(1);
                do {
                    {
                        {
                            setState(11);
                            ((RowContext) _localctx).STUFF = match(STUFF);

                            _localctx.i++;
                            if (_localctx.i == col)
                                System.out.println((((RowContext) _localctx).STUFF != null ? ((RowContext) _localctx).STUFF.getText() : null));

                        }
                    }
                    setState(15);
                    _errHandler.sync(this);
                    _la = _input.LA(1);
                } while (_la == STUFF);
            }
        } catch (RecognitionException re) {
            _localctx.exception = re;
            _errHandler.reportError(this, re);
            _errHandler.recover(this, re);
        } finally {
            exitRule();
        }
        return _localctx;
    }

    public static final String _serializedATN =
            "\u0004\u0001\u0003\u0012\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001" +
                    "\u0001\u0000\u0001\u0000\u0001\u0000\u0004\u0000\b\b\u0000\u000b\u0000" +
                    "\f\u0000\t\u0001\u0001\u0001\u0001\u0004\u0001\u000e\b\u0001\u000b\u0001" +
                    "\f\u0001\u000f\u0001\u0001\u0000\u0000\u0002\u0000\u0002\u0000\u0000\u0011" +
                    "\u0000\u0007\u0001\u0000\u0000\u0000\u0002\r\u0001\u0000\u0000\u0000\u0004" +
                    "\u0005\u0003\u0002\u0001\u0000\u0005\u0006\u0005\u0002\u0000\u0000\u0006" +
                    "\b\u0001\u0000\u0000\u0000\u0007\u0004\u0001\u0000\u0000\u0000\b\t\u0001" +
                    "\u0000\u0000\u0000\t\u0007\u0001\u0000\u0000\u0000\t\n\u0001\u0000\u0000" +
                    "\u0000\n\u0001\u0001\u0000\u0000\u0000\u000b\f\u0005\u0003\u0000\u0000" +
                    "\f\u000e\u0006\u0001\uffff\uffff\u0000\r\u000b\u0001\u0000\u0000\u0000" +
                    "\u000e\u000f\u0001\u0000\u0000\u0000\u000f\r\u0001\u0000\u0000\u0000\u000f" +
                    "\u0010\u0001\u0000\u0000\u0000\u0010\u0003\u0001\u0000\u0000\u0000\u0002" +
                    "\t\u000f";
    public static final ATN _ATN =
            new ATNDeserializer().deserialize(_serializedATN.toCharArray());

    static {
        _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
        for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
            _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
        }
    }
}